<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    <div class="can"></div>
</body>

<style>
    .can{
        width: 0;
    height: 0;
    border-top: 20px solid red;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 20px solid transparent;
}
</style>

<script>
for(var i  = 0;i <5 ;i++){
    var btn = document.createElement('button')
    btn.appendChild(document.createTextNode('button'+i))
    btn.addEventListener('click',function () {
        console.log(i);
    })
    document.body.appendChild(btn)
}
</script>
</html>